{% extends "package/resource_edit_base.html" %}

{% import 'macros/form.html' as form %}

{% block subtitle %}{{ h.dataset_display_name(pkg) }} - {{ h.resource_display_name(res) }}{% endblock %}

{% block primary_content_inner %}

  {% set action = h.url_for(
    controller='ckanext.datastore.controller:DatastoreController',
    action='dictionary', id=pkg.name, resource_id=res.id) %}

  <form method="post" action="{{ action }}" >
    {% block dictionary_form %}
      {% for f in fields %}
        <h3>{{ _( "Field {num}.").format(num=loop.index) }} {{ f.id }} ({{ f.type }})</h3>
        {{ form.input('f' ~ loop.index ~ 'label',
          label=_('Label'), id='field-f' ~ loop.index ~ 'label',
          value=f.get('info', {}).get('label', ''), classes=['control-full']) }}
        {{ form.markdown('f' ~ loop.index ~ 'notes',
          label=_('Description'), id='field-d' ~ loop.index ~ 'notes',
          value=f.get('info', {}).get('notes', '')) }}
      {% endfor %}
    {% endblock %}
    <button class="btn btn-primary" name="save" type="submit">
      <i class="fa fa-book"></i> {{ _('Save') }}
    </button>
  </form>
{% endblock %}
